package cn.cttic.app.mapper;

import cn.cttic.order.api.domain.BaseSaleOrder;
import cn.cttic.order.api.domain.vo.BaseSaleOrderVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.cttic.common.mybatis.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 销售订单Mapper接口
 *
 * @author Times.Studio
 * @date 2024-05-23
 */
public interface BaseSaleOrderMapper extends BaseMapperPlus<BaseSaleOrder, BaseSaleOrderVo> {

    @Select("<script>" +
        "SELECT\n" +
        "	saleOrder.* \n" +
        "FROM\n" +
        "	base_sale_order saleOrder\n" +
        "	INNER JOIN base_user appUser ON appUser.id = saleOrder.sales_man_id\n" +
        "	INNER JOIN base_product product ON product.id = saleOrder.product_id\n" +
        "	INNER JOIN base_device device ON device.id = product.device_id\n" +
        "${ew.customSqlSegment}" +
        "</script>")
    Page<BaseSaleOrderVo> searchPageList(Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper);

}
